Ext.onReady(function(){
    var processHistoryPanel=Ext.create('component.proces.history',{
        processInstanceId: procInstId,
        minHeight:100,
        colspan:2,
		contextPath:jypath
   });
	var fileAttachment = Ext.create('component.file.attachment',{
        objectId: id,
        imageType: "6",
        contextPath:contextPath
   });
   processHistoryPanel.setAutidStatusName(auditStatus);
   processHistoryPanel.setProcesHistoryVisible(processFlag);
	var changeRecordInfo = Ext.create("Ext.form.FormPanel", {
		autoWidth: true,
		autoHeight: true,
		fieldDefaults: {
            labelWidth: 120,
            labelAlign: "right",
            margin: "0 0 10 0"
        },
		items: [
			{
				xtype: "fieldcontainer", layout: "hbox",
				items: [
					{xtype: "displayfield", name: "old_signCode", fieldLabel: "业务编号", width: 400},
					{xtype: "displayfield", name: "old_businessType", fieldLabel: "业务类型", widht: 300}
				]
			},
			{
				xtype: "fieldcontainer", layout: "hbox",
				items: [
					{xtype: "displayfield", name: "old_customerName", fieldLabel: "客户姓名", width: 400},
					{xtype: "displayfield", name: "old_hrrReceived", fieldLabel: "已收金额", width: 400, renderer: Ext.util.Format.numberRenderer('0,000.00')}
				]
			},
			{xtype: "displayfield", name: "old_didTime", fieldLabel: "业务日期", width: 400,
				format: 'Y-m-d',
		    	renderer : function(val) {
					if(val!=null&&val!=""){
		    			console.log(val);
						return Ext.Date.format(new Date(val), "Y-m-d");
					}
					return null;
				}
			},
			{
				xtype: "fieldcontainer", layout: "hbox",
				items: [
					{xtype: "displayfield", name: "old_roomName", fieldLabel: "原楼盘名称及房号", width: 400},
					{xtype: "displayfield", name: "old_calculateArea", fieldLabel: "原计价面积", width: 400, renderer: Ext.util.Format.numberRenderer('0,000.00')}
				]
			},
			{
				xtype: "fieldcontainer", layout: "hbox",
				items: [
					{xtype: "displayfield", name: "old_conversionPrice", fieldLabel: "原房屋单价", width: 400, renderer: Ext.util.Format.numberRenderer('0,000.00')},
					{xtype: "displayfield", name: "old_lumpsumPrice", fieldLabel: "原折前总价", width: 400, renderer: Ext.util.Format.numberRenderer('0,000.00')}
				]
			},
			{
				xtype: "fieldcontainer", layout: "hbox",
				items: [
					{xtype: "displayfield", name: "new_roomName", fieldLabel: "所换楼盘名称及房号", width: 400},
					{xtype: "displayfield", name: "calculateArea", fieldLabel: "所换计价面积", width: 400, readOnly: true, renderer: Ext.util.Format.numberRenderer('0,000.00')}
				]
			},
			{
				xtype: "fieldcontainer", layout: "hbox",
				items: [
					{xtype: "displayfield", name: "bfdUnitPrice", fieldLabel: "所换房屋单价", width: 400, readOnly: true, renderer: Ext.util.Format.numberRenderer('0,000.00')},
					{xtype: "displayfield", name: "bfdTotalPrice", fieldLabel: "所换折前总价", width: 400, readOnly: true, renderer: Ext.util.Format.numberRenderer('0,000.00')}
				]
			},
			{
				xtype : 'textarea', fieldLabel : '换房原因', width: 800, maxLength: 255,
				name: "remark", allowBlank:false, blankText:'不能为空', readOnly: true
			},
			{
				xtype: "fieldcontainer", layout: "hbox",
				items: [
					{xtype: "displayfield", name: "agentName", fieldLabel: "经纪人", width: 400},
					{xtype: "displayfield", name: "applyDate", fieldLabel: "申请日期", width: 400,
						format: "Y-m-d",
						renderer : function(val) {
							if(val!=null&&val!=""){
				    			console.log(val);
								return Ext.Date.format(new Date(val), "Y-m-d");
							}
							return null;
						}
					}
				]
			},processHistoryPanel,fileAttachment
		],
        bbar : [
					{
						xtype: "button",
						text : "返回",
						id: "btn_back",
						name: "btn_back",
						hidden:hiddenBtn,
						icon : jypath + '/resources/ExtJSicons/shape_move_backwards.png',
						listeners: {
							click: function(){
								window.location.href=jypath+'/customer/signed/toView?id='+id+'&returnUrl=,marketing,pin,index';
							}
						}
					}
			]
	});
	
	changeRecordInfo.getForm().load({
	    url: jypath + '/marketing/changeroom/loadDetailById',
	    params: {"id": id},
	    success: function(form, action){

    	},
	    failure: function(form, action) {

    	}
	});
	
	var changeRecordPanel = Ext.create("Ext.panel.Panel", {
		renderTo:Ext.getBody(),
		title: "签约换房",
		items: [changeRecordInfo]
	});
});